home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 003 / propmgr1.arc / ADD1.BLD < prev    next >
Encoding:
Text File  |  1979-12-31  |  14.1 KB  |  498 lines

  1. * DATE 07/31/84  17:24
  2. * ADD.PRG
  3. * this program will add records to the current files
  4. SET INDEX TO
  5. STOR ' ' TO choice
  6. STOR t TO more
  7. SET INTENSITY ON
  8. SET COLON OFF
  9. DO WHIL more
  10. * set up screen for data entry
  11.  ERAS
  12. *loop until finished adding records
  13.  STOR 'Add Building Records' TO mode
  14.  STOR 'First enter data about the building. You then will be able to' TO prompt1
  15.  STOR 'enter tenant data before you enter another building.' TO prompt2
  16.  STOR 'To terminate session leave building blank and hit control Q' TO prompt3
  17.  @ 0,26 SAY mode
  18.  @ 1, 0 SAY " -------------------------------------------------"
  19.  @ 1,50 SAY "-----------------------------"
  20.  @ 3, 1 SAY "Address:"
  21.  @ 3,55 SAY "Code:"
  22.  @ 4, 4 SAY "City:"
  23.  @ 4,37 SAY "State:"
  24.  @ 4,56 SAY "Zip:"
  25.  @ 6, 1 SAY "Manager:"
  26.  @ 6,54 SAY "Phone:"
  27.  @ 7, 4 SAY "Type:"
  28.  @ 7,44 SAY "Number of Units:"
  29.  @ 9, 0 SAY "Acquired:"
  30.  @ 9,45 SAY "Purchase Price:"
  31.  @ 11,28 SAY "Send Rental Payments To:"
  32.  @ 12,00 SAY "Company:"
  33.  @ 12,54 SAY "Phone:"
  34.  @ 13,01 SAY "Street:"
  35.  @ 14,03 SAY "City:"
  36.  @ 15,00 SAY "Chks To:"
  37.  @ 17,02 SAY "Notes:"
  38.  @ 18,52 SAY "Updated:"
  39.  @ 19, 0 SAY " -------------------------------------------------"
  40.  @ 19,50 SAY "-----------------------------"
  41. * get a set of default memory variables for data entry
  42.  STOR '                                                  ' TO blnks
  43.  STOR $(blnks,1,35) TO mbaddr
  44.  STOR $(blnks,1,2) TO mbcode
  45.  STOR $(blnks,1,20) TO mbcity
  46.  STOR $(blnks,1,2) TO mbst
  47.  STOR $(blnks,1,5) TO mbzip
  48.  STOR $(blnks,1,25) TO mbmgr
  49.  STOR $(blnks,1,13) TO mbphone
  50.  STOR $(blnks,1,2) TO mbtype
  51.  STOR $(blnks,1,3) TO mbunit
  52.  STOR $(blnks,1,8) TO mbacq
  53.  STOR 0 TO mbprice
  54.  STOR $(blnks,1,35) TO mremit
  55.  STOR $(blnks,1,13) TO mphone
  56.  STOR $(blnks,1,35) TO mremitad
  57.  STOR $(blnks,1,35) TO mremitc
  58.  STOR $(blnks,1,50) TO mchecks
  59.  STOR $(blnks,1,50) TO mbnotes
  60.  STOR date() TO mbupdate
  61. * get drive letter from memory 039 hex
  62.  STOR chr(peek (063)) TO dr
  63. * let user enter data
  64.  @ 3,10 GET mbaddr
  65.  @ 3,61 GET mbcode PICTURE '99'
  66.  @ 4,10 GET mbcity
  67.  @ 4,44 GET mbst PICTURE '!!'
  68.  @ 4,61 GET mbzip PICTURE '99999'
  69.  @ 6,10 GET mbmgr
  70.  @ 6,61 GET mbphone PICTURE '(999)999-9999'
  71.  @ 7,10 GET mbtype
  72.  @ 7,61 GET mbunit
  73.  @ 9,10 GET mbacq PICTURE '99/99/99'
  74.  @ 9,61 GET mbprice
  75.  @ 12,10 GET mremit
  76.  @ 12,61 GET mphone PICTURE '(999)999-9999'
  77.  @ 13,10 GET mremitad
  78.  @ 14,10 GET mremitc
  79.  @ 15,10 GET mchecks
  80.  @ 17,10 GET mbnotes
  81.  @ 18,61 GET mbupdate PICTURE '99/99/99'
  82.  @ 20, 4 SAY prompt1
  83.  @ 21, 4 SAY prompt2
  84.  @ 22, 4 SAY prompt3
  85.  READ
  86.  CLEA GETS
  87. * if a building was entered
  88. * add a new record with the entered data
  89.  IF mbaddr <> ' '
  90. * validation
  91. * this module validates added records
  92. * test if there is a bad field validation
  93.   DO CASE
  94.   CASE mbcode = ' '
  95. * no building code
  96.    STOR t TO error
  97.   OTHE
  98.    STOR f TO error
  99.   ENDC
  100. * if test for error was true then fix the fields that need fixing
  101.   IF error
  102. * erase the lines to be used for prompts
  103.    @ 00,00
  104.    @ 20,00
  105.    @ 21,00
  106.    @ 22,00
  107. * tell them to correct it
  108.    @ 0,18 SAY 'Please Correct the Indicated Data'
  109. * keep looping until all fields are fixed
  110.    STOR t to an:error
  111.    DO WHIL an:error
  112.     DO CASE
  113.     CASE mbcode = ' '
  114.      @ 20,15 SAY 'Must have a building code                              '
  115.      @ 03,61 GET mbcode PICTURE '99'
  116.      READ
  117.     OTHE
  118.      STOR f TO an:error
  119.     ENDC
  120.    ENDD while an:error
  121.   ENDI error
  122.   RELE error, an:error
  123.   SET COLON ON
  124.   STOR 'N' TO command
  125.   @ 20,00
  126.   @ 21,00
  127.   @ 22,00
  128.   @ 20,15 SAY 'Are there any more changes ?                        '
  129.   @ 20,48 GET command picture '!'
  130.   READ
  131.   SET COLON OFF
  132.   IF command = 'Y'
  133.    @ 0,00
  134.    @ 0,26 SAY mode
  135.    @ 3,10 GET mbaddr
  136.    @ 3,61 GET mbcode PICTURE '99'
  137.    @ 4,10 GET mbcity
  138.    @ 4,44 GET mbst PICTURE '!!'
  139.    @ 4,61 GET mbzip PICTURE '99999'
  140.    @ 6,10 GET mbmgr
  141.    @ 6,61 GET mbphone PICTURE '(999)999-9999'
  142.    @ 7,10 GET mbtype
  143.    @ 7,61 GET mbunit
  144.    @ 9,10 GET mbacq PICTURE '99/99/99'
  145.    @ 9,61 GET mbprice
  146.    @ 12,10 GET mremit
  147.    @ 12,61 GET mphone PICTURE '(999)999-9999'
  148.    @ 13,10 GET mremitad
  149.    @ 14,10 GET mremitc
  150.    @ 15,10 GET mchecks
  151.    @ 17,10 GET mbnotes
  152.    @ 18,61 GET mbupdate PICTURE '99/99/99'
  153.    @ 20,00
  154.    @ 21,00
  155.    @ 22,00
  156.    READ
  157.    CLEA GETS
  158.   ENDI command = 'Y'
  159. * add new record
  160.   APPE BLANK
  161.   REPL baddr WITH mbaddr, bcode WITH mbcode
  162.   REPL bcity WITH mbcity+mbst+mbzip
  163.   REPL bdata WITH mbmgr+mbphone+mbtype+mbunit+mbacq
  164.   REPL bprice WITH mbprice, remit WITH mremit, phone WITH mphone
  165.   REPL remitad WITH mremitad, remitc WITH mremitc
  166.   REPL checks WITH mchecks, bnotes with mbnotes, bupdate WITH mbupdate
  167.   RELE mbcity, mbst, mbzip, mbmgr, mbphone, mbtype, mbunit, mbacq
  168.   RELE mbprice, mremit, mphone, mremitad, mremitc
  169.   RELE mchecks, mbnotes, mode, prompt1, prompt2, prompt3
  170.   SELE SECONDARY
  171.   USE &dr.:tenant
  172.   STOR t TO more1
  173.   STOR t TO first
  174.   ERAS
  175.   DO WHIL more1
  176.    IF first
  177.     STOR 'Add Tenant Records' TO mode
  178.     STOR 'Enter as many tenants as you want. When done, enter a blank for tenant' TO prompt1
  179.     STOR "name and unit or control 'Q' to end session." TO prompt2
  180.     @ 0,26 SAY mode
  181.     @ 1, 0 SAY " -------------------------------------------------"
  182.     @ 1,50 SAY "----------------------------"
  183.     @ 3, 2 SAY "Tenant:"
  184.     @ 3,53 SAY "Code:"
  185.     @ 4, 4 SAY "Unit:"
  186.     @ 4,26 SAY "Building:"
  187.     @ 5, 1 SAY "Contact:"
  188.     @ 5,52 SAY "Phone:"
  189.     @ 6,09 SAY "Alternate mailing address:"
  190.     @ 7,01 SAY "Address:"
  191.     @ 8,01 SAY "City:"
  192.     @ 10, 4 SAY "Type:"
  193.     @ 10,19 SAY "Addl Percentage:"
  194.     @ 10,48 SAY "1st Lease:"
  195.     @ 11,04 SAY "Base:"
  196.     @ 11,47 SAY "Expiration:"
  197.     @ 12, 0 SAY "Security:"
  198.     @ 12,30 SAY "Bank:"
  199.     @ 12,48 SAY "Late Date:"
  200.     @ 13, 4 SAY "Rent:"
  201.     @ 13,25 SAY "Late Chgs:"
  202.     @ 13,48 SAY "Addl Rent:"
  203.     @ 14, 3 SAY "G & E:"
  204.     @ 14,24 SAY "Other Chgs:"
  205.     @ 15, 0 SAY "Rent Due:"
  206.     @ 15,22 SAY "Last Payment:"
  207.     @ 15,49 SAY "Amt Paid:"
  208.     @ 16,00 SAY "Total Yr:"
  209.     @ 16,30 SAY "Flag:"
  210.     @ 16,52 SAY "Total:"
  211.     @ 18, 3 SAY "Notes:"
  212.     @ 18,51 SAY "Update:"
  213.     @ 19, 0 SAY " -------------------------------------------------"
  214.     @ 19,50 SAY "-----------------------------"
  215.    ENDI first
  216.    STOR f TO first
  217.    STOR $(blnks,1,35) TO mtenant
  218.    STOR $(blnks,1,3) TO mtcode
  219.    STOR $(blnks,1,5) to mtunit
  220.    STOR 'R' TO mttype
  221.    STOR $(blnks,1,25) TO mtcontac
  222.    STOR $(blnks,1,13) TO mtphone
  223.    STOR 'N' TO malt
  224.    STOR $(blnks,1,35) TO maltad
  225.    STOR $(blnks,1,35) TO maltcty
  226.    STOR $(blnks,1,8) TO mtexpir
  227.    STOR $(blnks,1,8) TO mtfirst
  228.    STOR 0 TO mtsec
  229.    STOR $(blnks,1,4) TO mtsecb
  230.    STOR $(blnks,1,2) TO mtlate
  231.    STOR 0 TO mtrent
  232.    STOR 0.0000 TO mtrentpc
  233.    STOR 0 TO mtrenpcr
  234.    STOR 0 TO mtlatec
  235.    STOR 0 TO mtaddl
  236.    STOR 0 TO mtrente
  237.    STOR 0 TO mtrentm
  238.    STOR 0 TO mtrentd
  239.    STOR $(blnks,1,8) TO mtrentpd
  240.    STOR 0 TO mtrentp
  241.    STOR 0 TO mtrenty
  242.    STOR 0 TO mtrentt
  243.    STOR $(blnks,1,8) TO mtflag
  244.    STOR $(blnks,1,35) TO mtnotes
  245.    STOR mbupdate TO mtupdate
  246. * setup gets to read data
  247.    @ 3,10 GET mtenant
  248.    @ 3,59 SAY mbcode
  249.    @ 3,61 GET mtcode PICTURE '999'
  250.    @ 4,10 GET mtunit
  251.    @ 4,36 SAY mbaddr
  252.    @ 5,10 GET mtcontac
  253.    @ 5,59 GET mtphone PICTURE '(999)999-9999'
  254.    @ 6,36 GET malt PICTURE '!'
  255.    @ 7,10 GET maltad
  256.    @ 8,10 GET maltcty
  257.    @ 10,10 GET mttype PICTURE '!'
  258.    @ 10,36 GET mtrentpc
  259.    @ 10,59 GET mtfirst PICTURE '99/99/99'
  260.    @ 11,10 GET mtrenpcr
  261.    @ 11,59 GET mtexpir PICTURE '99/99/99'
  262.    @ 12,10 GET mtsec
  263.    @ 12,36 GET mtsecb
  264.    @ 12,59 GET mtlate PICTURE '99'
  265.    @ 13,10 GET mtrent
  266.    @ 13,36 GET mtlatec
  267.    @ 13,59 GET mtaddl
  268.    @ 14,10 GET mtrente
  269.    @ 14,36 GET mtrentm
  270.    @ 15,10 GET mtrentd
  271.    @ 15,36 GET mtrentp PICTURE '99/99/99'
  272.    @ 15,59 GET mtrentp
  273.    @ 16,10 GET mtrenty
  274.    @ 16,36 GET mtflag PICTURE '99/99/99'
  275.    @ 16,59 GET mtrentt
  276.    @ 18,10 GET mtnotes
  277.    @ 18,61 GET mtupdate PICTURE '99/99/99'
  278.    @ 20,00
  279.    @ 21,00
  280.    @ 22,00
  281.    @ 20, 7 SAY prompt1
  282.    @ 21, 7 SAY prompt2
  283.    READ
  284.    CLEA GETS
  285. * test if there is a bad field validation
  286.    IF mtenant <> ' '
  287. * validation
  288.     DO CASE
  289.     CASE mtcode = ' '
  290.      STOR t TO error
  291.     CASE .NOT.(malt = 'Y' .OR. malt = 'N')
  292.      STOR t TO error
  293.     CASE .NOT.(mttype = 'R'.OR.mttype='P'.OR. mttype='O')
  294.      STOR t TO error
  295.     CASE (mttype = 'P'.OR. mttype = 'O') .AND.(.NOT.(mtrentpc >0.AND. mtrenpcr >0))
  296.      STOR t TO error
  297.     OTHE
  298.      STOR f TO error
  299.     ENDC
  300. * if test for error was true then fix the fields that need fixing
  301.     IF error
  302. * erase the lines to be used for prompts
  303.      @ 00,00
  304.      @ 20,00
  305.      @ 21,00
  306.      @ 22,00
  307. * tell them to correct it
  308.      @ 0,18 SAY 'Please Correct the Indicated Data'
  309. * keep looping until all fields are fixed
  310.      STOR t to an:error
  311.      DO WHIL an:error
  312.       DO CASE
  313.       CASE mtcode = ' '
  314.        @ 20,00
  315.        @ 20,15 SAY 'Must have a tenant code                              '
  316.        @ 03,61 GET mtcode PICTURE '999'
  317.        READ
  318.       CASE .NOT.(malt = 'Y' .OR. malt = 'N')
  319.        @ 20,00
  320.        @ 20,15 SAY "Must answer 'Y' or 'N' to alternate address"
  321.        @ 06,36 GET malt PICTURE '!'
  322.        READ
  323.       CASE .NOT.(mttype = 'R'.OR.mttype='P'.OR. mttype='O')
  324.        @ 20,00
  325.        @ 21,00
  326.        @ 20,05 SAY "Type must be 'R' for Regular, 'P' for Percentage which uses the higher of"
  327.        @ 21,05 SAY "the percentage or the base rent or 'O' for Overage plus base rent"
  328.        @ 10,10 GET mttype PICTURE '!'
  329.        READ
  330.       CASE (mttype = 'P'.OR. mttype = 'O').AND.(.NOT.(mtrentpc>0.AND. mtrenpcr> 0))
  331.        @ 20,00
  332.        @ 21,00
  333.        @ 20,05 SAY 'If a percentage or overage lease, you must state the percentage'
  334.        @ 21,05 SAY 'AND the base for calculating the percentage rent'
  335.        @ 10,36 GET mtrentpc
  336.        @ 11,10 GET mtrenpcr
  337.        READ
  338.       OTHE
  339.        STOR f TO an:error
  340.       ENDC
  341.      ENDD while an:error
  342.     ENDI error
  343. * give them another chance
  344.     SET COLON ON
  345.     STOR 'N' TO command
  346.     @ 20,00
  347.     @ 21,00
  348.     @ 22,00
  349.     @ 20,15 SAY 'Are there any more changes ?                        '
  350.     @ 20,48 GET command picture '!'
  351.     READ
  352.     SET COLON OFF
  353.     IF command = 'Y'
  354.      @ 0,00
  355.      @ 0,26 SAY mode
  356.      @ 3,10 GET mtenant
  357.      @ 3,59 SAY mbcode
  358.      @ 3,61 GET mtcode PICTURE '999'
  359.      @ 4,10 GET mtunit
  360.      @ 4,36 SAY mbaddr
  361.      @ 5,10 GET mtcontac
  362.      @ 5,59 GET mtphone PICTURE '(999)999-9999'
  363.      @ 6,36 GET malt PICTURE '!'
  364.      @ 7,10 GET maltad
  365.      @ 8,10 GET maltcty
  366.      @ 10,10 GET mttype PICTURE '!'
  367.      @ 10,36 GET mtrentpc
  368.      @ 10,59 GET mtfirst PICTURE '99/99/99'
  369.      @ 11,10 GET mtrenpcr
  370.      @ 11,59 GET mtexpir PICTURE '99/99/99'
  371.      @ 12,10 GET mtsec
  372.      @ 12,36 GET mtsecb
  373.      @ 12,59 GET mtlate PICTURE '99'
  374.      @ 13,10 GET mtrent
  375.      @ 13,36 GET mtlatec
  376.      @ 13,59 GET mtaddl
  377.      @ 14,10 GET mtrente
  378.      @ 14,36 GET mtrentm
  379.      @ 15,10 GET mtrentd
  380.      @ 15,36 GET mtrentp PICTURE '99/99/99'
  381.      @ 15,59 GET mtrentp
  382.      @ 16,10 GET mtrenty
  383.      @ 16,36 GET mtflag PICTURE '99/99/99'
  384.      @ 16,59 GET mtrentt
  385.      @ 18,10 GET mtnotes
  386.      @ 18,61 GET mtupdate PICTURE '99/99/99'
  387.      @ 20,00
  388.      @ 21,00
  389.      @ 22,00
  390. * let user enter data
  391.      READ
  392.      CLEA GETS
  393.     ENDI command = 'Y'
  394. * put data in file
  395.     APPE BLANK
  396.     STOR mbcode + mtcode TO mbcod1
  397.     REPL tenant WITH mtenant, bcode WITH mbcod1, tunit WITH mtunit
  398.     REPL baddr WITH mbaddr, tcontac WITH mtcontac, tphone WITH mtphone
  399.     REPL alt WITH malt, altad WITH maltad, altcty WITH maltcty
  400.     REPL ttype WITH mttype, texpir WITH mtexpir
  401.     REPL trentpc WITH mtrentpc, trentpcr WITH mtrenpcr
  402.     REPL tfirst WITH mtfirst, tsec WITH mtsec, tsecb WITH mtsecb
  403.     REPL tlate WITH mtlate, trent WITH mtrent, tlatec WITH mtlatec
  404.     REPL taddl WITH mtaddl, trente WITH mtrente, trentm WITH mtrentm
  405.     REPL trentd WITH mtrentd, trentpd WITH mtrentpd, trentp WITH mtrentp
  406.     REPL trenty WITH mtrenty, trentt WITH mtrentt, tflag WITH mtflag
  407.     REPL tnotes WITH mtnotes,tupdate WITH mtupdate
  408.     STOR t TO more1
  409.    ELSE
  410. * get ready to stop the loop
  411.     STOR f TO more1
  412.    ENDI mtenant <> ' '
  413.   ENDD WHILE more1
  414.   SET COLON ON
  415.   STOR 'A' TO command
  416.   ERAS
  417. TEXT
  418.  
  419.       The newly added information is in the database - but will not
  420.       show up on screen until the records are reindexed............
  421.       and reindexing may take a few minutes.
  422.  
  423.       Moreover, if you have additional buildings to add, you should
  424.       not index until they are all added.
  425.  
  426.       In any event, you can reindex at any time.  There is an option
  427.       to reindex on the Maintenance menu.
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439. ENDT
  440.   @ 15,10 SAY "Do you wish to REINDEX now (Y/N) or ADD (A) another building ?"
  441.   @ 15,72 GET command PICTURE '!'
  442.   READ
  443.   CLEA GETS
  444.   DO WHIL @(command, 'ANY') = 0
  445.    @ 15,72 GET command PICTURE '!'
  446.    READ
  447.    CLEA GETS
  448.   ENDD
  449.   DO CASE
  450.   CASE command = 'Y'
  451. * restore original index and reindex
  452. * since it takes time, tell them
  453.    ERAS
  454.    @ 02,00 SAY 'Files are now being reindexed. '
  455.    @ 03,00 SAY 'Please be patient as this will take a few minutes.'
  456.    @ 04,00 SAY 'I will keep you posted as I go along'
  457.    @ 05,00 SAY ' '
  458. *index transitional part in secondary database
  459.    STOR chr(peek(063)) to dr
  460.    SET ECHO ON
  461.    SET TALK ON
  462.    SELE primary
  463.    USE &dr.:build INDEX &dr.:code
  464.    INDE ON bcode to &dr.:code
  465.    SELE SECONDARY
  466.    USE &dr.:TENANT INDEX &dr.:codea
  467.    INDE on bcode to &dr.:codea
  468.    SET ECHO OFF
  469.    SET TALK OFF
  470.    STOR f TO more
  471.    STOR t TO first
  472.    STOR ' ' TO choice
  473.   CASE command = 'N'
  474.    STOR f TO more
  475.    STOR chr(peek(063)) to dr
  476.    SELE PRIMARY
  477.    USE &dr.:build INDEX &dr.:code
  478.    STOR ' ' TO choice
  479.    STOR t TO first
  480.   CASE command  = 'A'
  481.    STOR t TO more
  482.    STOR chr(peek(063)) TO dr
  483.    SELE PRIMARY
  484.    USE &dr.:build
  485.    STOR t TO first
  486.    STOR 'A' TO choice
  487.   ENDC
  488.  ELSE
  489.   STOR f TO more
  490.  ENDI mbaddr
  491. ENDD WHILE MORE
  492. STOR CHR(PEEK(063)) TO dr
  493. SELE PRIMARY
  494. USE &dr.:build
  495. SET INDEX TO &dr.:code
  496. SET INTENSITY OFF
  497. STOR t TO first
  498.